import service from "@/service";

//wbs管理-树形数据
export function getScheduleWbs(orgCode) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/scheduleWbs/getTreeData?orgCode=${orgCode}`,
    method: "POST",
  });
}

// 检测单位
export function getTestUnitByUserIdAndTenantCode(parameter) {
  let { permissionCode } = app;
  let { userId, tenantCode } = parameter;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-org/getTestUnitByUserIdAndTenantCode?userId=${userId}&tenantCode=${tenantCode}`,
    method: "POST",
    data: {
      systemCode: permissionCode,
    },
  });
}

//根据用户登录id,租户id查询标段列表数据
export function getBlockList(parameter) {
  let { permissionCode } = app;
  let { userId, tenantCode } = parameter;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/user/sys-org/getInfoByUserIdAndTenantCode?userId=${userId}&tenantCode=${tenantCode}`,
    method: "POST",
    data: {
      systemCode: permissionCode,
    },
  });
}

// 查询字典
export function distDataList(parameter) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-dict-data/list`,
    method: "POST",
    data: parameter,
  });
}

// 数据分析
export function chartList(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-chart/chartList`,
    method: "POST",
    data,
  });
}

// 检测台账
// 列表
export function getAccountList(data) {
  let { page, pageSize } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/listPage?page=${page}&pageSize=${pageSize}`,
    method: "POST",
    data,
  });
}

// 查询项目的试验树列表-试验台账
export function recordListByTenantCode() {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-trial-type/recordListByTenantCode`,
    method: "GET",
  });
}

// 树节点点击查询树
export function trialList(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-dict-data/trialList`,
    method: "POST",
    data,
  });
}

// 作废
export function invalidData(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-warning-disposal/invalidData`,
    headers: {
      "Content-Type": "multipart/form-data",
    },
    method: "POST",
    data,
  });
}

// 抽提
export function detailGCJC(id) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/detailGCJC?id=${id}`,
    method: "GET",
  });
}

// 试验委托
// 列表
export function getCommissionList(data) {
  let { page, pageSize } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/listPage?page=${page}&pageSize=${pageSize}`,
    method: "POST",
    data,
  });
}

// 查询项目的试验树列表-试验委托/检测
export function listByTenantCode() {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-trial-type/listByTenantCode`,
    method: "GET",
  });
}

// 试验信息
export function trialInfo(params) {
  let { trialNum } = params;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-trial-standard/trialInfo?trialNum=${trialNum}`,
    method: "GET",
  });
}

// 水泥信息
export function snInfo(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-trial-standard/snInfo`,
    method: "GET",
    params,
  });
}

// 设备信息
export function equlist(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-equ/equlist`,
    method: "GET",
    params,
  });
}

// 沥青信息
export function lqInfo(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-trial-standard/lqInfo`,
    method: "GET",
    params,
  });
}

// 沥青马歇尔信息
export function lqmxeInfo(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-trial-standard/lqmxeInfo`,
    method: "GET",
    params,
  });
}

// 新增
export function addCommission(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/add`,
    method: "POST",
    data,
  });
}

// 详情
export function commissionDetail(reportId) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/detail?reportId=${reportId}`,
    method: "GET",
  });
}

// 编辑
export function editCommission(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/edit`,
    method: "POST",
    data,
  });
}

// 删除
export function deleteReport(reportId) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/delete?reportId=${reportId}`,
    method: "GET",
  });
}

// 试验检测-入库单列表
export function inbaseList(data) {
  let { page, pageSize } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beam/materialInbaseInfo/api/inbaseList?page=${page}&pageSize=${pageSize}`,
    method: "POST",
    data,
  });
}

//试验检测

//查询检测结果
export function getListByTaskNum(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/listByTestNum`,
    method: "GET",
    params,
  });
}

//新增检测结果
export function testDataAdd(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/add`,
    method: "POST",
    data,
  });
}

//查询任务单
export function getTestDataListByTaskNum(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-task/listByReportId`,
    method: "GET",
    params,
  });
}

//查询试验单
export function getListByReportIdAndTaskNum(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-single/listByReportIdAndTestNum`,
    method: "GET",
    params,
  });
}

//查询工程检测
export function getListByTrialNum(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/config-trial-type/listByTrialNum`,
    method: "GET",
    params,
  });
}

// 详情
export function detectionDetail(reportId) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/detailGCJC?reportId=${reportId}`,
    method: "GET",
  });
}

// 新增
export function addGCJC(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/addGCJC`,
    method: "POST",
    data,
  });
}

//级配表头
export function getHeaderList(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/headerList`,
    method: "GET",
    params,
  });
}

//检测结果-详情
export function getDetailAuto(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/detailAuto`,
    method: "GET",
    params,
  });
}

// 试验规程
// 列表
export function getProcedureList(data) {
  let { page, pageSize } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-procedure/listPage?page=${page}&pageSize=${pageSize}`,
    method: "POST",
    data,
  });
}

// 新增
export function add(data, standardName) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-procedure/add?standardName=${standardName}`,
    headers: {
      "Content-Type": "multipart/form-data",
    },
    method: "POST",
    data,
  });
}

// 详情
export function detail(id) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-procedure/detail?id=${id}`,
    method: "GET",
  });
}

// 编辑
export function edit(data, form) {
  let { standardName, id, fileId } = form;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-procedure/edit?standardName=${standardName}&id=${id}&fileId=${fileId}`,
    headers: {
      "Content-Type": "multipart/form-data",
    },
    method: "POST",
    data,
  });
}

// 删除
export function deleteTest(id) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-procedure/delete?id=${id}`,
    method: "GET",
  });
}

// 预警管理
// 列表
export function getWarnList(data) {
  let { page, pageSize } = data;
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/warnListPage?page=${page}&pageSize=${pageSize}`,
    method: "POST",
    data,
  });
}

// 数据详情
export function dataDetail(parameter) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/detail`,
    method: "GET",
    params: parameter,
  });
}

// 处理详情
export function getDisposalDetail(parameter) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-warning-disposal/getDisposalDetail`,
    method: "GET",
    params: parameter,
  });
}

// 处理
export function saveDisposal(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-warning-disposal/saveDisposal`,
    headers: {
      "Content-Type": "multipart/form-data",
    },
    method: "POST",
    data,
  });
}

// 闭合
export function saveClose(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-warning-disposal/saveClose`,
    headers: {
      "Content-Type": "multipart/form-data",
    },
    method: "POST",
    data,
  });
}

// 查询实验类型
export function trialNumList(params) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/trialNumList`,
    method: "GET",
    params,
  });
}

// 查询有数据的日期（台账、数据分析、预警）
export function getTestHasDataDate(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-test-data/queryDate`,
    method: "POST",
    data,
  });
}

// 查询有数据的日期（实验委托、试验检测）
export function getReportHasDataDate(data) {
  return service({
    baseUrl: "gateWaybaseUrl",
    url: `/beamTrial/trial-report/queryDate`,
    method: "POST",
    data,
  });
}
